//
//  URL_to_PLISTDictionary.cpp
//  sad
//
//  Created by Christopher Kemsley on 2/3/12.
//  Copyright (c) 2012 iAppolopolis. All rights reserved.
//

#include "Codec.hpp"
#include "PLISTParser.hpp"
#include "URL.hpp"


struct URL_to_PLISTDictionary : public aCodec < PLISTParser::Dictionary* , URL* >
{
	URL_to_PLISTDictionary ()
	:	aCodec<PLISTParser::Dictionary*,URL*> ()
	{ }
	
	
	virtual bool	runDecode		( Any const & anyView , Any const & anyModel )
		{
		PLISTParser::Dictionary*	info	=	anyModel.as<PLISTParser::Dictionary*>() ;
		URL&						path	=	* anyView.as<URL*>() ;
		
		Any INFO ;
		if ( XMLParser :: parse ( path , INFO ) )
			{
			*info = INFO.as<PLISTParser::Dictionary>() ;
			return true ;
			}
		
		return false ;
		}
	
} ;
URL_to_PLISTDictionary _URL_to_PLISTDictionary_ ;
